package com.leetcode.题库;

/**
 * @author 覃国强
 * @date 2022-02-25 10:15
 */
public class 题库_0537_复数乘法 {

  public static void main(String[] args) {

  }

  static
  class Solution {
    public String complexNumberMultiply(String num1, String num2) {
      String[] nums1 = num1.split("\\+");
      String[] nums2 = num2.split("\\+");

      int a = Integer.parseInt(nums1[0]);
      int b = Integer.parseInt(nums1[1].substring(0, nums1[1].length() - 1));


      int c = Integer.parseInt(nums2[0]);
      int d = Integer.parseInt(nums2[1].substring(0, nums2[1].length() - 1));

      int real = a * c - b * d;
      int imaginary = b * c + a * d;
      return real + "+" + imaginary + "i";
    }
  }


}
